package homework.test4;

import java.io.File;

/*
..使用递归的方式删除指定文件夹
 */
public class Demo4 {
    public static void main(String[] args) {
        File file = new File("Day11\\src\\homework\\test1\\test2");
        deleteFile(file);
    }

    private static void deleteFile(File file) {
        File [] files = file.listFiles();
        for (File f : files) {
            if(f.isFile()){
                f.delete();
            }else{
                deleteFile(f);
            }
        }
        file.delete();
    }

}
